grammar Calculator;
program: statement+ ;

statement : expression NEWLINE              # printExpression
          | ID '=' expression NEWLINE       # assign
          | NEWLINE                         # blank
          ;

expression : expression op=('*'|'/') expression     # MulDiv
           | expression op=('+'|'-') expression     # AddSub
           | INT                                    # int
           | ID                                     # id
           | '(' expression ')'                     # parents
           ;

ID: [a-zA-Z]+ ;
INT: [0-9]+ ;
NEWLINE: '\r'? '\n' ;
WS: [ \t]+ -> skip ;

MUL: '*' ;
DIV: '/' ;
ADD: '+' ;
SUB: '-' ;
